<?php  

namespace app\admin\controller;

use think\Controller;
use think\Request;
use think\Db;


class Jifen extends Admin
{
	public function cha()
	{

       $array = Db::name('tb_users')->select();
       $arr = $array[0];
       
       $list = Db::table('to_jifen')
        ->alias('j')
        ->join('tb_users u','j.uid = u.id')
        ->field(['j.id as jid','u.id as userid','j.uid','u.name','j.jifen','u.phone'])
       
        ->select();
        // var_dump($list);die;
    
        $this->assign('list',$list);  



		return $this->fetch('jifen/jifen');
	}

     //积分清零
	 public function delete($id)
   {
     
   	 $result = Db::name('to_jifen')->where('id',$id)->data(['jifen'=>0])->update();
     
     if ($result >0 ) {
       $info['status'] = true;
     }else{
       $info['status'] = false;
     }

     return $info;
}

}